package ar.edu.utn.frsf.cidisi.upcolbpip2pn.generator.petrinet;

public class Arc2PN
{
  protected static String nl;
  public static synchronized Arc2PN create(String lineSeparator)
  {
    nl = lineSeparator;
    Arc2PN result = new Arc2PN();
    nl = null;
    return result;
  }

  public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
  protected final String TEXT_1 = "      <arc id=\"";
  protected final String TEXT_2 = "\"" + NL + "           orientation=\"";
  protected final String TEXT_3 = "\"" + NL + "           order=\"1\">" + NL + "        <posattr x=\"0.000000\"" + NL + "                 y=\"0.000000\"/>" + NL + "        <fillattr colour=\"White\"" + NL + "                  pattern=\"\"" + NL + "                  filled=\"false\"/>" + NL + "        <lineattr colour=\"Black\"" + NL + "                  thick=\"1\"" + NL + "                  type=\"Solid\"/>" + NL + "        <textattr colour=\"Black\"" + NL + "                  bold=\"false\"/>" + NL + "        <arrowattr headsize=\"1.200000\"" + NL + "                   currentcyckle=\"2\"/>" + NL + "        <transend idref=\"";
  protected final String TEXT_4 = "\"/>" + NL + "        <placeend idref=\"";
  protected final String TEXT_5 = "\"/>" + NL + "        <annot id=\"";
  protected final String TEXT_6 = "\">" + NL + "          <posattr x=\"-202.000000\"" + NL + "                   y=\"190.000000\"/>" + NL + "          <fillattr colour=\"White\"" + NL + "                    pattern=\"Solid\"" + NL + "                    filled=\"false\"/>" + NL + "          <lineattr colour=\"Black\"" + NL + "                    thick=\"0\"" + NL + "                    type=\"Solid\"/>" + NL + "          <textattr colour=\"Black\"" + NL + "                    bold=\"false\"/>" + NL + "          <text tool=\"CPN Tools\"" + NL + "                version=\"2.2.0\">";
  protected final String TEXT_7 = "</text>" + NL + "        </annot>" + NL + "      </arc>";
  protected final String TEXT_8 = NL;

  public String generate(Object argument)
  {
    final StringBuffer stringBuffer = new StringBuffer();
     Arc arc = (Arc) argument; 
    stringBuffer.append(TEXT_1);
    stringBuffer.append( arc.getId());
    stringBuffer.append(TEXT_2);
    stringBuffer.append( arc.getOrientation());
    stringBuffer.append(TEXT_3);
    stringBuffer.append( arc.getTransition().getId());
    stringBuffer.append(TEXT_4);
    stringBuffer.append( arc.getPlace().getId());
    stringBuffer.append(TEXT_5);
    stringBuffer.append( arc.getAnnotId());
    stringBuffer.append(TEXT_6);
    stringBuffer.append( arc.getText());
    stringBuffer.append(TEXT_7);
    stringBuffer.append(TEXT_8);
    return stringBuffer.toString();
  }
}
